"""
用例基类
"""
import unittest

from tools.logger import logger
from tools.tools import open_app2


class BaseCase(unittest.TestCase):
    """APP端用例基类"""
    driver = None

    def setUp(self):
        """方法级别初始化（每条用例前执行）"""
        self.driver = open_app2()  # 初始化 driver
        logger.info(f"启动 Appium Driver: {self.driver}")
        logger.info(f"开始执行用例: {self._testMethodName}")

    def tearDown(self):
        """方法级别清理（每条用例后执行）"""
        if self.driver:
            self.driver.quit()
            logger.info("关闭 Appium Driver")
            logger.info(f"结束用例: {self._testMethodName}")